{% extends "_base_nav.html" %}

{% load i18n %}

{% block post_content %}
{% load app_tags %}

<link href="/static/stylesheets/home.css?{% server_start_time %}" media="screen, projection" rel="stylesheet" type="text/css" />

{% endblock %}

{% get_current_language as LANGUAGE_CODE %}

{% block content %}
<div class="home">
    {% if LANGUAGE_CODE == 'zh' %}
    <section class="parl-banner">
        <div class="parl-banner-content m-1">
            <a href="{% url 'parl' %}" target="_blank">百度PaddlePaddle正式发布深度强化学习框架PARL</a>
        </div>
        <div class="parl-banner-dismiss">
            <i class="fas fa-times" data-toggle="tooltip" data-placement="right" title="Close"></i>
        </div>
    </section>
    {% endif %}

    <section class="hero-carousel">
        <div id="carousel-controls" class="carousel slide" data-ride="carousel">
            <div class="carousel-inner">
                <div class="carousel-item active">
                    {% if LANGUAGE_CODE == 'zh' %}
                        <div class="newyear-banner py-5"></div>
                    {% else %}
                    <div class="intro-banner py-5">
                        <div class="container">
                            <div class="tag-line mb-4 pt-{% if LANGUAGE_CODE == 'zh' %}5{% else %}2{% endif %}">
                                {% blocktrans %}An easy-to-use, easy-to-learn&nbsp;<br class="br"/>deep learning platform{% endblocktrans %}
                            </div>
                            <div class="sub-title mb-5">{% blocktrans %}An open-source deep learning platform with a&nbsp;<br class="br"/>simple API, trusted by the world’s leading AI teams{% endblocktrans %}</div>

                            <button id="hero-quick-start" class="btn selected col-lg-3 mr-4 mb-4">
                                {% trans "Get Started"%}
                            </button>

                            <button id="hero-learn-more" class="btn col-lg-3 mb-4"
                                    href="/about_{% if LANGUAGE_CODE != 'zh' %}en{% else %}cn{% endif %}.html"
                                    type="text/html">{% trans "Learn more"%}
                            </button>

                            <div class="dot-area">
                                <div class="dot-group">
                                    <span class="dot"></span>
                                </div>
                                <div class="dot-group">
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                </div>
                                <div class="dot-group">
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                </div>
                                <div class="dot-group">
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                </div>
                                <div class="dot-group">
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                </div>
                                <div class="dot-group">
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                </div>
                                <div class="dot-group">
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                </div>
                                <div class="dot-group">
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                    <span class="dot"></span>
                                </div>
                            </div>

                            <div class="arch arch-1"></div>
                            <div class="arch arch-2"></div>
                            <div class="arch arch-3"></div>
                        </div>
                    </div>
                    {% endif %}
                </div>

                {% if LANGUAGE_CODE == 'zh' %}
                <div class="carousel-item">
                    <a href="/suite">
                        <div class="pps-banner py-5">
                            <div class="container py-5">
                                <div class="tag-line pt-5">PaddlePaddle Suite</div>
                                <div class="sub-title py-4">PaddlePaddle Suite是一个深度学习全功能套件，<br/>能够满足深度学习开发的多种需求</div>
                            </div>
                        </div>
                    </a>
                </div>

                <div class="carousel-item">
                    <a href="http://ai.baidu.com/support/news?action=detail&id=637&hmsr=aibanner&hmpl=huangpu" target="_blank">
                        <div class="huangpu-banner py-5">
                        </div>
                    </a>
                </div>

                {% endif %}
            </div>
            {% if LANGUAGE_CODE == 'zh' %}
            <a class="carousel-control-prev" href="#carousel-controls" role="button" data-slide="prev">
                <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                <span class="sr-only">Previous</span>
            </a>
            <a class="carousel-control-next" href="#carousel-controls" role="button" data-slide="next">
                <span class="carousel-control-next-icon" aria-hidden="true"></span>
                <span class="sr-only">Next</span>
            </a>
            {% endif %}
        </div>
    </section>

    <!-- Features sections, currently supports 4 features -->
    <section class="features pb-5" id="features-head">
        <div class="container">
            <div class="bubble-background" id="features-bubble">
            </div>
            <div class="row">
                <div class="col-lg-3">
                    <div class="feature-desc">
                        <div class="feature-icon mb-4 mx-auto">
                            <h3 class="my-3">{% trans "Easy to learn"%}</h3>
                        </div>
                        <p>{% blocktrans %}PaddlePaddle provides multitudes of tools and tutorials; Become a deep learning developer in no time.{% endblocktrans %}</p>
                    </div>
                </div>
                <div class="col-lg-3">
                    <div class="feature-desc">
                        <div class="feature-icon mb-4 mx-auto">
                            <h3>{% trans "Ease of use"%}</h3>
                        </div>
                        <p>{% blocktrans %}PaddlePaddle provides an intuitive and flexible interface for loading data and specifying model structures; Bring your creativity to reality.{% endblocktrans %}</p>
                    </div>
                </div>
                <div class="col-lg-3">
                    <div class="feature-desc">
                        <div class="feature-icon mb-4 mx-auto">
                            <h3>{% trans "Security"%}</h3>
                        </div>
                        <p>{% blocktrans %}PaddlePaddle is backed by Baidu’s AI technology and business practices. The framework is safe and stable. Focus your works and not worries.{% endblocktrans %}</p>
                    </div>
                </div>
                <div class="col-lg-3">
                    <div class="feature-desc">
                        <div class="feature-icon mb-4 mx-auto">
                            <h3>{% trans "Efficiency"%}</h3>
                        </div>
                        <p>{% blocktrans %}It also provides extremely optimized operations, memory, and network communication. Kick start your projects in no time with the latest Baidu business models.{% endblocktrans %}</p>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!-- End of Features sections -->

    <!-- Installation Guide Section -->
    <section class="installation-guide">
        <div class="container py-5">
            <h2>{% trans "Install"%}</h2>
            <p class="mt-2 mb-4">
                {% trans "Get PaddlePaddle up and running quick after installing the newest version of <a href='https://pip.pypa.io/en/stable/installing/'>pip</a>"%}
            </p>

            <div class="row mb-4">
                <div class="left col-lg-6">
                    <div class="row mb-3">
                        <div class="col-6">
                            <button id="CPU" class="install-option selected">
                                CPU
                            </button>
                        </div>
                        <div class="col-6">
                            <button id="GPU" class="install-option">
                                GPU
                            </button>
                        </div>
                    </div>

                    <!-- cuda version selection bar, only enabled when Cuda selected-->
                    <div id="cuda-version" class="row disable">
                        <div class="col-4">
                            <button id="-gpu" class="install-option cuda selected">
                                <div class="cuda-title">CUDA 9</div>
                                <div class="cuda-caption">cuDNN 7.0</div>
                            </button>
                        </div>
                        <div class="col-4">
                            <button id="-gpu==1.2.1.post87" class="install-option cuda">
                                <div class="cuda-title">CUDA 8</div>
                                <div class="cuda-caption">cuDNN 7.0</div>
                            </button>
                        </div>
                        <div class="col-4">
                            <button id="-gpu==1.2.1.post85" class="install-option cuda">
                                <div class="cuda-title">CUDA 8</div>
                                <div class="cuda-caption">cuDNN 5.0</div>
                            </button>
                        </div>
                    </div>
                </div>

                <!-- Display what commend to install PaddlePaddle, should match the height of option buttons -->
                <div class="right col-lg-6">
                    <div class="terminal">
                        <div class="terminal-bar">
                        </div>
                        <p> $ </p><code id="commend">pip install paddlepaddle</code>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-6">
                    <p>{% trans "Tested on <a href=https://wiki.centos.org/Download>CentOS 6</a>, <a href=https://www.ubuntu.com/download>Ubuntu 14.04</a>+"%}</p>
                </div>
                <!-- Link to docker installation -->
                <div class="col-lg-6">
                    <a class="other-install" href="/documentation/docs/{% if LANGUAGE_CODE == 'zh' %}zh/1.2/beginners_guide/install/install_Windows.html{% else %}en/1.2/build_and_install/index_en.html{% endif %}">
                        {% blocktrans %}Install on Windows, MacOS, or other options{% endblocktrans %}</a>
                </div>
            </div>
        </div>

        <!-- Start of Step 1-2-3 -->
        <div class="container step-1-2-3">
            <h2>{% blocktrans %}Get Started{% endblocktrans %}</h2>
            <p class="mt-2 mb-4">
                {% trans "This example has been written for Python 2.7 specifically. Note that PaddlePaddle also officially supports Python 3.5/3.6/3.7." %}
            </p>

            <div class="row mt-4">
                <div class="left col-sm-4">
                    <!-- Step 1. Import PaddlePaddle -->
                    <div class="row mb-3">
                        <div class="col-12">
                            <button id="step-button-1" class="step-button show in-focus selected" data-step-id="1">
                                1. {% blocktrans %}Configure the network{% endblocktrans %}
                            </button>
                        </div>
                    </div>

                    <!-- Step 2. Load dataset and train -->
                    <div class="row mb-3">
                        <div class="col-12">
                            <button id="step-button-2" class="step-button" data-step-id="2">
                                2. {% blocktrans %}Define train & infer functions{% endblocktrans %}
                            </button>
                        </div>
                    </div>

                    <!-- Step 3. Make a prediction -->
                    <div class="row mb-3">
                        <div class="col-12">
                            <button id="step-button-3" class="step-button" data-step-id="3">
                                3. {% blocktrans %}Train and make a prediction{% endblocktrans %}
                            </button>
                        </div>
                    </div>
                </div>

                <!-- code panel -->
                <div class="right col-sm-8">
                    <div class="code-panel">
                        <div class="code-panel-bar">
                        </div>
                        <div class="row col-lg-12">
                            <pre>
                                <code id="step-1" class="step-code show in-focus python">
<span class="hljs-comment"># Include libraries.</span>
import paddle
import paddle.fluid as fluid
import numpy
import six

<span class="hljs-comment"># Configure the neural network.</span>
def net(x, y):
    y_predict = fluid.layers.fc(input=x, size=1, act=None)
    cost = fluid.layers.square_error_cost(input=y_predict, label=y)
    avg_cost = fluid.layers.mean(cost)
    return y_predict, avg_cost</code>

                                <code id="step-2" class="step-code python">
<span class="hljs-comment"># Define train function.</span>
def train(save_dirname):
    x = fluid.layers.data(name='x', shape=[13], dtype='float32')
    y = fluid.layers.data(name='y', shape=[1], dtype='float32')
    y_predict, avg_cost = net(x, y)
    sgd_optimizer = fluid.optimizer.SGD(learning_rate=0.001)
    sgd_optimizer.minimize(avg_cost)
    train_reader = paddle.batch(
        paddle.reader.shuffle(paddle.dataset.uci_housing.train(), buf_size=500),
        batch_size=20)
    place = fluid.CPUPlace()
    exe = fluid.Executor(place)
    def train_loop(main_program):
        feeder = fluid.DataFeeder(place=place, feed_list=[x, y])
        exe.run(fluid.default_startup_program())

        PASS_NUM = 1000
        for pass_id in range(PASS_NUM):
            total_loss_pass = 0
            for data in train_reader():
                avg_loss_value, = exe.run(
                    main_program, feed=feeder.feed(data), fetch_list=[avg_cost])
                total_loss_pass += avg_loss_value
                if avg_loss_value < 5.0:
                    if save_dirname is not None:
                        fluid.io.save_inference_model(
                            save_dirname, ['x'], [y_predict], exe)
                    return
            print("Pass %d, total avg cost = %f" % (pass_id, total_loss_pass))

    train_loop(fluid.default_main_program())

<span class="hljs-comment"># Infer by using provided test data.</span>
def infer(save_dirname=None):
    place = fluid.CPUPlace()
    exe = fluid.Executor(place)
    inference_scope = fluid.core.Scope()
    with fluid.scope_guard(inference_scope):
        [inference_program, feed_target_names, fetch_targets] = (
            fluid.io.load_inference_model(save_dirname, exe))
        test_reader = paddle.batch(paddle.dataset.uci_housing.test(), batch_size=20)

        test_data = six.next(test_reader())
        test_feat = numpy.array(list(map(lambda x: x[0], test_data))).astype("float32")
        test_label = numpy.array(list(map(lambda x: x[1], test_data))).astype("float32")

        results = exe.run(inference_program,
                          feed={feed_target_names[0]: numpy.array(test_feat)},
                          fetch_list=fetch_targets)
        print("infer results: ", results[0])
        print("ground truth: ", test_label)</code>

                                <code id="step-3" class="step-code python">
<span class="hljs-comment"># Run train and infer.</span>
if __name__ == "__main__":
    save_dirname = "fit_a_line.inference.model"
    train(save_dirname)
    infer(save_dirname)</code>
                            </pre>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- End of Step 1-2-3 -->
    </section>
    <!-- End of Installation Guide Section -->

    <section class="models">
        <div class="container">
            <div class="row models-slogan">
                <h1 class="col-lg-12">{% trans "Build powerful applications with PaddlePaddle"%}</h1>
                <div class="six-dots col">
                    <span class="dot"></span>
                    <span class="dot"></span>
                    <span class="dot"></span>
                    <span class="dot"></span>
                    <span class="dot"></span>
                    <span class="dot"></span>
                </div>
            </div>

            <!--   6 models in 2 columns    -->
            <div class="model-examples">
                <!--   title    -->

                <!--   row 1    -->
                <div class="row model-row">
                    <div class="col-lg-6">
                        <div class="model-cell">
                            <div class="row model-cell-row">
                                <div class=" model-icon">
                                    <svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 150"><defs><style>.cls-1{fill:none;stroke:#fff;stroke-linecap:round;stroke-linejoin:round;stroke-width:3px;}</style></defs><title>models-word2vec</title><line class="cls-1" x1="64.5" y1="38.5" x2="47.5" y2="38.5"/><line class="cls-1" x1="47.5" y1="115.5" x2="47.5" y2="38.5"/><line class="cls-1" x1="64.5" y1="115.5" x2="47.5" y2="115.5"/><line class="cls-1" x1="85.5" y1="38.5" x2="102.5" y2="38.5"/><line class="cls-1" x1="102.5" y1="115.5" x2="102.5" y2="38.5"/><line class="cls-1" x1="85.5" y1="115.5" x2="102.5" y2="115.5"/></svg>
                                </div>
                                <div class="col-lg-7 model-intro">
                                    <h3>
                                        {% blocktrans %}Word2Vec{% endblocktrans %}
                                    </h3>
                                    <p>
                                        {% blocktrans %}Express words as real vectors to calculate similarities between them.{% endblocktrans %}
                                    </p>
                                    <div class="learn-more">
                                        <a href="https://github.com/PaddlePaddle/book/blob/develop/04.word2vec/README{% if LANGUAGE_CODE == 'zh' %}.cn{% endif %}.md" target="_blank">
                                            {% trans "Learn more"%}
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-6 model-right-column">
                        <div class="model-cell">
                            <div class="row model-cell-row">
                                <div class=" model-icon">
                                    <svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 150"><defs><style>.cls-1{fill:none;stroke:#fff;stroke-linecap:round;stroke-linejoin:round;stroke-width:3px;}</style></defs><title>models-rs</title><polygon class="cls-1" points="75.36 37 87.06 60.7 113.22 64.5 94.29 82.95 98.76 109 75.36 96.7 51.97 109 56.44 82.95 37.51 64.5 63.67 60.7 75.36 37"/></svg>
                                </div>
                                <div class="col-lg-7 model-intro">
                                    <h3>
                                        {% blocktrans %}Recommender System{% endblocktrans %}
                                    </h3>
                                    <p>
                                        {% blocktrans %}Recommend potentially interesting information or commodities to users based on their features.{% endblocktrans %}
                                    </p>
                                    <div class="learn-more">
                                        <a href="https://github.com/PaddlePaddle/book/blob/develop/05.recommender_system/README{% if LANGUAGE_CODE == 'zh' %}.cn{% endif %}.md" target="_blank">
                                            {% trans "Learn more"%}
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!--   row 2    -->
                <div class="row model-row">
                    <div class="col-lg-6">
                        <div class="model-cell">
                            <div class="row model-cell-row">
                                <div class=" model-icon">
                                    <svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 150"><defs><style>.cls-1{fill:none;stroke:#fff;stroke-linecap:round;stroke-linejoin:round;stroke-width:3px;}</style></defs><title>models-sentiment</title><circle class="cls-1" cx="76.5" cy="71.5" r="42"/><path class="cls-1" d="M80.5,70.5s0-10,15-10S80.5,70.5,80.5,70.5Z"/><path class="cls-1" d="M72.7,70.5s0-10-15-10S72.7,70.5,72.7,70.5Z"/><path class="cls-1" d="M53.5,79.5s23,17,46,0C99.5,98.5,60.5,103.5,53.5,79.5Z"/><path class="cls-1" d="M80.5,55.5s14-5,22,0"/><path class="cls-1" d="M72.5,55.5s-14-5-22,0"/></svg>
                                </div>
                                <div class="col-lg-7 model-intro">
                                    <h3>
                                        {% blocktrans %}Understand Sentiment{% endblocktrans %}
                                    </h3>
                                    <p>
                                        {% blocktrans %}Predict the emotion expressed in a piece of text as positive or negative.{% endblocktrans %}
                                    </p>
                                    <div class="learn-more">
                                        <a href="https://github.com/PaddlePaddle/book/blob/develop/06.understand_sentiment/README{% if LANGUAGE_CODE == 'zh' %}.cn{% endif %}.md" target="_blank">
                                            {% trans "Learn more"%}
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-6 model-right-column">
                        <div class="model-cell">
                            <div class="row model-cell-row">
                                <div class=" model-icon">
                                    <svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 150"><defs><style>.cls-1{fill:none;stroke:#fff;stroke-linecap:round;stroke-linejoin:round;stroke-width:3px;}</style></defs><title>models-imageclassification</title><rect class="cls-1" x="40" y="40.01" width="68.5" height="68.49"/><path class="cls-1" d="M72.5,69.5s15-10,22-4,5,16,5,16-3,15-22,16c-15,.79-28-2-28-16S60.5,65.5,72.5,69.5Z"/><path class="cls-1" d="M65.5,53.5s-1,8,5,12S73.5,55.5,65.5,53.5Z"/></svg>
                                </div>
                                <div class="col-lg-7 model-intro">
                                    <h3>
                                        {% blocktrans %}Image Classification{% endblocktrans %}
                                    </h3>
                                    <p>
                                        {% blocktrans %}Classify images based on their semantic information.{% endblocktrans %}
                                    </p>
                                    <div class="learn-more">
                                        <a href="https://github.com/PaddlePaddle/book/blob/develop/03.image_classification/README{% if LANGUAGE_CODE == 'zh' %}.cn{% endif %}.md" target="_blank">
                                            {% trans "Learn more"%}
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!--   row 3    -->
                <div class="row model-row">
                    <div class="col-lg-6">
                        <div class="model-cell">
                            <div class="row model-cell-row">
                                <div class=" model-icon">
                                    <svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 150"><defs><style>.cls-1{fill:none;stroke:#fff;stroke-linecap:round;stroke-linejoin:round;stroke-width:3px;}</style></defs><title>models-translation</title><polygon class="cls-1" points="95.35 53.89 39.62 53.89 39.62 90.84 39.64 90.84 39.56 109 58.41 90.89 58.41 90.84 95.35 90.84 95.35 53.89"/><polygon class="cls-1" points="112.34 81.13 112.29 69.06 112.3 69.06 112.3 44.5 75.25 44.5 75.25 53.89 95.35 53.89 95.35 69.06 99.81 69.06 99.81 69.09 112.34 81.13"/></svg>
                                </div>
                                <div class="col-lg-7 model-intro">
                                    <h3>
                                        {% blocktrans %}Machine Translation{% endblocktrans %}
                                    </h3>
                                    <p>
                                        {% blocktrans %}Translate between different languages via deep learning.{% endblocktrans %}
                                    </p>
                                    <div class="learn-more">
                                        <a href="https://github.com/PaddlePaddle/book/blob/develop/08.machine_translation/README{% if LANGUAGE_CODE == 'zh' %}.cn{% endif %}.md" target="_blank">
                                            {% trans "Learn more"%}
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-6 model-right-column">
                        <div class="model-cell">
                            <div class="row model-cell-row">
                                <div class=" model-icon">
                                    <svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 150"><defs><style>.cls-1{fill:none;stroke:#fff;stroke-linecap:round;stroke-linejoin:round;stroke-width:3px;}</style></defs><title>models-ssd2</title><path class="cls-1" d="M29,74.89c52.84,58.76,96,0,96,0C72.16,16.13,29,74.89,29,74.89Z"/><ellipse class="cls-1" cx="77.33" cy="74.52" rx="12" ry="13.34"/></svg>                               </div>
                                <div class="col-lg-7 model-intro">
                                    <h3>
                                        {% blocktrans %}SSD Object Detection{% endblocktrans %}
                                    </h3>
                                    <p>
                                        {% blocktrans %}Use the SSD model in PaddlePaddle for object detection.{% endblocktrans %}
                                    </p>
                                    <div class="learn-more">
                                        <a href="https://github.com/PaddlePaddle/models/blob/develop/fluid/PaddleCV/object_detection/README{% if LANGUAGE_CODE == 'zh' %}_cn{% endif %}.md" target="_blank">
                                            {% trans "Learn more"%}
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!--   10 arches   -->
            <div class="arch arch-1">
            </div>
            <div class="arch arch-2">
            </div>
            <div class="arch arch-3">
            </div>
            <div class="arch arch-4">
            </div>
            <div class="arch arch-5">
            </div>
            <div class="arch arch-6">
            </div>
            <div class="arch arch-7">
            </div>
            <div class="arch arch-8">
            </div>
            <div class="arch arch-9">
            </div>
            <div class="arch arch-10">
            </div>
        </div>
    </section>

    <!-- Resources section: Only in Chinese version -->
    {% get_current_language as LANGUAGE_CODE %}
    {% if LANGUAGE_CODE == 'zh' %}

    <section class="resources-guide" id="resources-head">
        <div class="container">
            <div class="bubble-background" id="resources-bubble">
            </div>
            <div class="row">
                <h2 class="col-lg-12">基于PaddlePaddle框架，我们还提供了这些服务和学习资源</h2>
            </div>
            <div class="row">
                <div class="col-lg-4">
                    <a class="resource-cell" href="http://ai.baidu.com/paddlepaddle/openCourses">
                        <svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 75 75"><defs><style>.cls-11,.cls-12{fill:none;stroke-width:2px;}.cls-11{stroke-miterlimit:10;}.cls-12{stroke-linecap:round;stroke-linejoin:round;}</style></defs><title>resource-studio</title><circle class="cls-11" cx="37" cy="37" r="27.5"/><polygon class="cls-12" points="41.4 40.95 41.63 40.82 41.52 40.72 50.61 24.34 34.23 33.43 34.13 33.33 34.01 33.55 33.78 33.68 33.88 33.78 24.8 50.16 41.17 41.07 41.27 41.17 41.4 40.95"/></svg>                        <h3>深度学习基础知识</h3>
                        <p>百度联合多家教育培训机构共同打造超过400+节、累计3000+分钟的深度学习精品课程体系，帮助开发者从零掌握深度学习</p>
                    </a>
                </div>
                <div class="col-lg-4">
                    <a class="resource-cell" href="http://aistudio.baidu.com">
                        <svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 75 75"><defs><style>.cls-221{fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:2px;}</style></defs><title>resource-study</title><polygon class="cls-221" points="14 23.75 37.5 36.5 61 24.5 37.5 11 14 23.75"/><line class="cls-221" x1="61" y1="25" x2="61" y2="53"/><line class="cls-221" x1="14" y1="24" x2="14" y2="53"/><line class="cls-221" x1="37.5" y1="37" x2="37.5" y2="64"/><line class="cls-221" x1="37.5" y1="65" x2="14" y2="53"/><line class="cls-221" x1="37.5" y1="65" x2="61" y2="53"/></svg>                        <h3>AI Studio</h3>
                        <p>为开发者提供线上深度学习代码环境以及配套的算法、算力、数据支持，一站式满足使用者学习、技术进阶、学术研究的需求</p>
                    </a>
                </div>
                <div class="col-lg-4">
                    <a class="resource-cell" href="http://visualdl.paddlepaddle.org/">
                        <svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 75 75"><defs><style>.cls-331{opacity:0.75;}.cls-332{opacity:0.5;}</style></defs><title>resource-vdl</title><circle cx="37.55" cy="18.87" r="3.47"/><circle class="cls-331" cx="37.55" cy="27.94" r="3.47"/><circle class="cls-331" cx="37.55" cy="37.02" r="3.47"/><circle cx="71.53" cy="37.02" r="3.47"/><circle cx="46.03" cy="23.44" r="3.47"/><circle class="cls-331" cx="46.03" cy="32.52" r="3.47"/><circle class="cls-332" cx="54.29" cy="46.08" r="3.47"/><circle class="cls-332" cx="37.54" cy="55.14" r="3.47"/><circle class="cls-331" cx="37.54" cy="46.07" r="3.47"/><circle class="cls-331" cx="46.03" cy="41.47" r="3.47"/><circle class="cls-332" cx="46.03" cy="50.66" r="3.47"/><circle cx="54.52" cy="27.94" r="3.47"/><circle class="cls-331" cx="54.54" cy="37.02" r="3.47"/><circle cx="63.48" cy="32.52" r="3.47"/><circle class="cls-332" cx="63.48" cy="41.47" r="3.47"/><circle cx="3.32" cy="37.08" r="3.47"/><circle class="cls-332" cx="28.82" cy="50.66" r="3.47"/><circle cx="20.57" cy="28.02" r="3.47"/><circle cx="28.82" cy="23.44" r="3.47"/><circle class="cls-332" cx="20.34" cy="46.16" r="3.47"/><circle class="cls-332" cx="11.37" cy="41.58" r="3.47"/><circle cx="11.37" cy="32.63" r="3.47"/></svg>                        <h3>Visual DL</h3>
                        <p>通过Visual DL可以帮助开发者方便的观测训练整体趋势、数据样本质量和中间结果、参数分布和变化趋势、以及模型的结构，帮助开发者更便捷的完成编程过程</p>
                    </a>
                </div>
            </div>
        </div>
    </section>
    {% endif %}
    <!-- End of Resources section -->

    <!-- Video section: Only in Chinese -->
    {% if LANGUAGE_CODE == 'zh' %}

    <section class="video">
        <div class="previous-video">
            <img src="/static/images/right_array.png"></img>
        </div>

        <div class="container">
            <div class="row">
                <div class="col-lg-12">
                    <!-- TODO: Update with the real assets-->
                    <img class="big-img" id="videoImage" src="/static/images/explaining-paddlers.png">
                    </img>
                    <div class="video-cell" id="vid">
                        <h2 id="vid-title">PaddlePaddle，让AI触手可及</h2>
                        <p id="vid-desc">PaddlePaddle是一个开源的深度学习引擎，能够帮助你快速高效地实现任何想要的AI创意</p>
                        <button class="watch-now" data-toggle="modal" data-target="#videoModal">
                            <div class="triangle-right"></div>
                            Watch Video
                        </button>
                    </div>
                </div>
            </div>
        </div>

        <div class="next-video">
            <img src="/static/images/right_array.png"></img>
        </div>
    </section>

    <!-- Video Modal -->
    <div class="modal" id="videoModal" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-dialog-video" role="document">
            <div class="modal-content">
                <video controls width="640px" height="360px" id="videoControl">
                    <source id="videoLink" type="video/mp4">
                    <source id="videoWebm" type="video/webm">
                    <p>Your browser doesn't support HTML5 video.</p>
                </video>
            </div>
        </div>
    </div>
    {% endif %}
    <!-- End of Video section -->

    <!-- Feedback section: Only in Chinese -->
    {% if LANGUAGE_CODE == 'zh' %}

    <section class="feedback">
        <div id="problem_feedback" class="feedback_item">
            <i class="far fa-edit icon"></i>
            <a class="alt_txt" href="https://ai.baidu.com/forum/topic/list/168/5" target="_blank">问题反馈</a>
        </div>
        <div id="contact_us" class="feedback_item">
            <i class="far fa-envelope icon"></i>
            <a class="alt_txt" data-toggle="modal" data-target="#feedbackModal">联系我们</a>
        </div>
        <div id="follow_us" class="feedback_item">

            <i class="fas fa-qrcode icon"></i>
            <a class="alt_txt">关注我们</a>
        </div>
        <div class="qr_code">
            <p>关注PaddlePaddle公众号</p>
            <p>获取深度学习信息</p>
            <img src="/static/images/paddlepaddle_qr_code.jpg">
        </div>
    </section>

    {% endif %}
    <!-- End of Feedback section -->

</div>

{% endblock %}
{% block scripts %}
{{ block.super }}

<link rel="stylesheet"
      href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>
    // Scroll page down to quick start section on 'Quick Start' button click.
    $('#hero-quick-start').click(function(event){
        event.preventDefault();

        $('html, body').stop().animate({ scrollTop: $(
            '.step-1-2-3').offset().top - 70 }, 500);
    });

    $('#hero-learn-more').click(function(event){
        event.preventDefault();

        var href = ($(this).attr('href'));
            window.location = href;
            return true;
    });


    $('.installation-guide .install-option').click(function(event){
        if (event.target.tagName == 'DIV')
            event.target = $(event.target).parent()[0];
        var installationToShow = event.target.id;
        var installCommend = 'pip install paddlepaddle';

        if (installationToShow == 'CPU') {
            // Reverse the currently selected nav button and then select this one.
            $('#GPU').removeClass('selected');
            $("#cuda-version").addClass('disable');

            // Select the target
            $(event.target).addClass('selected');
        } else {
            if (installationToShow == 'GPU') {
                $('#CPU').removeClass('selected');
                $("#cuda-version").removeClass('disable');
            } else {
                $('.installation-guide div > .install-option.cuda').removeClass('selected');
            }

            // Select the target
            $(event.target).addClass('selected');

            var t = $('.installation-guide div > .install-option.cuda.selected');

            installCommend = installCommend + t[0].id;
        }

        // Update the installation commend
        $('#commend').html(installCommend);
    });

    $('.step-button').click(function (event) {
        var steps = $('.step-code');
        steps.removeClass('show');
        steps.removeClass('in-focus');

        var stepToFocusOn = $('#step-' + event.target.dataset.stepId);

        $.each(steps, function (index, step) {
            step = $(step);
            step.addClass('show');
            return step[0] !== stepToFocusOn[0];
        });

        stepToFocusOn.addClass('in-focus');

        $(".step-button").removeClass('selected');
        $(this).addClass('selected');
    });

    // Start a timer to rotate the video infos and links
    var rotateTimer = false
    if ($('#vid').length) {
      rotateTimer = setInterval(rotate, 10000);
    }
    var videoTitles = ['PaddlePaddle，让AI触手可及', '“桃子分拣机对我的帮助非常大”', 'AI会发现并记录你在公共场所的不良行为'];
    var videoDescs = ['PaddlePaddle是一个开源的深度学习引擎，能够帮助你快速高效地实现任何想要的AI创意', '四个大学生用一个假期时间，基于PaddlePaddle平台打造了通过外观、尺寸等特征进行桃子质量分级的机器，帮助桃农节约了大量劳动成本', '百度员工打造的AI控烟方案，当你在禁止吸烟的公共场所吸烟时，就会被AI实时捕捉并将你的吸烟图像投放至附近的屏幕上'];
    var videoLinks = ['http://paddle-org.bj.bcebos.com/videos/paddlepaddle%E5%B8%B8%E8%A7%84%E7%89%881080P.mp4', 'http://paddle-org.bj.bcebos.com/videos/1.%20%E5%A4%A7%E6%A1%83%E7%BA%AA%E5%BD%95%E7%89%87%E6%9C%80%E7%BB%88%E7%89%88%20%E9%AB%98%E6%B8%85%E7%89%88.mp4', 'http://paddle-org.bj.bcebos.com/videos/%E7%99%BE%E5%BA%A6%E6%97%A0%E7%83%9F%E6%97%A5%E7%97%85%E6%AF%92%E8%A7%86%E9%A2%91_%E5%86%85%E9%83%A8_final.mp4']
    var videoWebm = ['http://paddle-org.bj.bcebos.com/videos/paddlepaddle%E5%B8%B8%E8%A7%84%E7%89%881080P.webm', 'http://paddle-org.bj.bcebos.com/videos/1.%20%E5%A4%A7%E6%A1%83%E7%BA%AA%E5%BD%95%E7%89%87%E6%9C%80%E7%BB%88%E7%89%88%20%E9%AB%98%E6%B8%85%E7%89%88.webm', 'http://paddle-org.bj.bcebos.com/videos/%E7%99%BE%E5%BA%A6%E6%97%A0%E7%83%9F%E6%97%A5%E7%97%85%E6%AF%92%E8%A7%86%E9%A2%91_%E5%86%85%E9%83%A8_final.webm']

    var videoBGs = ['/static/images/explaining-paddlers.png', '/static/images/peach-paddlers.png', '/static/images/smoking-paddlers.png']
    var count = 0;

    $('.previous-video').click(function (event){
      if (count == 0) {
        count = videoTitles.length
      }
      count -= 1;

      updateVideo()
      clearInterval(rotateTimer);
      rotateTimer = setInterval(rotate, 10000);
    });

    $('.next-video').click(function (event){
      rotate();
      clearInterval(rotateTimer);
      rotateTimer = setInterval(rotate, 10000);
    });

    function rotate() {
        count += 1;
        updateVideo();
    }

    function updateVideo() {
        // Update video link
        $('#videoLink').attr("src", videoLinks[count % 3]);
        $('#videoWebm').attr("src", videoWebm[count % 3]);

        // Update title and desc with fade in and fade out
        $('#vid-title').fadeOut(function() {
          $(this).text(videoTitles[count % 3]).fadeIn();
        });

        $('#vid-desc').fadeOut(function() {
          $(this).text(videoDescs[count % 3]).fadeIn();
        });

        // Update background image position
        var videoImage = $("#videoImage")
        if( videoImage.css('display') != 'none') {
            videoImage.fadeOut(function() {
                $(this).attr("src", videoBGs[count % 3]);
                $(this).fadeIn();
            });
        }
    }

    updateVideo();

    $('#videoModal').on('show.bs.modal', function (e) {
        var video = document.getElementById('videoControl');
        video.load();

        clearInterval(rotateTimer);
        rotateTimer = false;

        video.play();
    })

    $('#videoModal').on('hidden.bs.modal', function (e) {
        var video = document.getElementById('videoControl');
        video.pause();
        rotateTimer = setInterval(rotate, 10000);
    })

    // Subtle animation on the bubble
    $(window).scroll(function (event) {
        var scroll = $(window).scrollTop();
        var featuresHead = $('#features-head')
        var resourcesHead = $('#resources-head')

        $('#features-bubble').css('top', (-700 + (scroll - featuresHead.position().top) / 2));

        if ($('#resources-bubble').length) {
            $('#resources-bubble').css('top', (-800 + (scroll - resourcesHead.position().top) / 2));
        }
    });

    hljs.initHighlightingOnLoad();

    // Display the QR code on hover
    $('#follow_us').hover(function () {
        var steps = $('.qr_code');
        steps.addClass('show');
    },function () {
        var steps = $('.qr_code');
        steps.removeClass('show');
    });

    var parlBanner = $('.parl-banner');
    if (parlBanner.length){
        var parlClose = $('i', parlBanner);
        parlClose.tooltip();
        parlClose.click(function(){
            parlBanner.slideUp();
        });
    }
</script>

{% endblock %}
